import {Form, Button, Input, Row, Col, Cascader, DatePicker,InputNumber,Radio  } from 'antd';
import moment from 'moment';
import styles from './index.less';
const FormItem = Form.Item;

function query({form, onOk }){

  const {getFieldDecorator,getFieldsValue,resetFields} = form;
  const { MonthPicker, RangePicker } = DatePicker;
  const formItemLayout = {
    // labelCol: { span: 7 },
    wrapperCol: { span: 20 },
    colon:false,
  };
  const submit = () => {
    const values = getFieldsValue();
      values.isServing= values.isServing && values.isServing[0],
    onOk(values);

  };

  const handleChange = (key, values) => {
    let fields = getFieldsValue()
    fields[key] = values
    fields = handleFields(fields)
    onFilterChange(fields)
  }

  const reset = () => {
    resetFields();
  }
  return(

    <Form
      onSubmit={submit}
    >
      <Row>
        <Col span={6}>
          <FormItem
            {...formItemLayout}
          >
            {
              getFieldDecorator('customerName',)(
                <Input size='large' placeholder='客户中文名称'/>
              )
            }
          </FormItem>
        </Col>
        <Col span={6}>
          <FormItem
            {...formItemLayout}
          >
            {
              getFieldDecorator('customerNum',)(
                <Input size='large' placeholder='客户编号'/>
              )
            }
          </FormItem>
        </Col>
        <Col span={6}>
          <FormItem
            {...formItemLayout}
          >
            {
              getFieldDecorator('customerEname', )(
                <Input size='large'  placeholder='客户英文名字'/>
              )
            }
          </FormItem>
        </Col>
        <Col span={6}>
          <FormItem
            {...formItemLayout}
          >
            {
              getFieldDecorator('customerAbbreviation',)(
                <Input size='large' placeholder='客户简称'/>
              )
            }
          </FormItem>
        </Col>
      </Row>
      <Row>
        <Col span={6}>
          <FormItem
            {...formItemLayout}
          >
            {
              getFieldDecorator('customerProperty', )(
                <Cascader
                  showSearch
                  size='large'
                  placeholder='客户性质'
                  options={[
                            {value:1,label:'企业'},
                            {value:2,label:'代表处'},
                            {value:3,label:'无机构'},
                        ]}
                  />
              )
            }
          </FormItem>
        </Col>
        <Col span={6}>
          <FormItem
            {...formItemLayout}
          >
            {
              getFieldDecorator('customerType',)(
                <Cascader
                  size='large'
                  placeholder='客户类型'
                  showSearch
                  options={[
                            {value:1,label:'国家'},
                            {value:2,label:'集体'},
                            {value:3,label:'民营'},
                            {value:4,label:'外资'},
                            {value:5,label:'侨资'},
                            {value:6,label:'合资'},
                            {value:7,label:'中资'},
                            {value:8,label:'其他'},
                          ]}
                 />
              )
            }
          </FormItem>
        </Col>
        <Col span={6}>
          <FormItem
            {...formItemLayout}
          >
            {
              getFieldDecorator('industryCategory', )(
                <Cascader
                   size='large'
                  placeholder='行业类别'
                   showSearch
                   options={[
                            {value:1,label:'房地产/建筑/物业/装饰房屋中介'},
                            {value:2,label:'金融/保险/证券/投资 '},
                            {value:3,label:'医疗医药'},
                            {value:4,label:'物流运输'},
                            {value:5,label:'工厂制造业'},
                            {value:6,label:'汽车自动化'},
                            {value:7,label:'化工与能源'},
                            {value:8,label:'百货/连锁'},
                            {value:9,label:'快销/耐销'},
                            {value:10,label:'广告/多媒体'},
                            {value:11,label:'服务/教育/培训'},
                            {value:12,label:'其他'},
                          ]}
                  />
              )
            }
          </FormItem>
        </Col>
        <Col span={6}>
          <FormItem
            {...formItemLayout}
          >
            {
              getFieldDecorator('isServing', )(
                 <Cascader
                  size='large'
                  placeholder='客户在服状态'
                  showSearch
                  options={[
                          {value:1,label:'在服'},
                          {value:0,label:'停服'},
                        ]}
                />
              )
            }
          </FormItem>
        </Col>
      </Row>
      <Row>
        <Col span={24} style={{ textAlign: 'right'}}>
          <Button type='primary' icon='search' onClick={ submit } style={{ marginRight: 20 }}>查 询</Button>
          <Button onClick={reset} style={{ marginRight: 20 }}>清 除</Button>
        </Col>
      </Row>
    </Form>

  )
}

export default Form.create()(query);
